public class TwoArrayExercise6 {
    public static void main(String[] args) {
        int[][] yangHui = new int[10][];

        for (int i = 0; i < yangHui.length; i++) {
            /*
            当i=0， yangHui[0]的长度是1
            当i=1， yangHui[0]的长度是2
                   yangHui[i]的长度是i+1
             */
            yangHui[i] = new int[i+1];

            yangHui[i][0] = 1;//每一行的第1个元素
            System.out.print(yangHui[i][0]+"\t");

            //中间的元素，j=1排除第1列，j<yangHui[i].length-1排除最后1列
            for(int j=1; j<yangHui[i].length-1; j++){
                yangHui[i][j] = yangHui[i-1][j-1] + yangHui[i-1][j];
                System.out.print(yangHui[i][j]+"\t");
            }

            // yangHui[i][yangHui[i].length-1] = 1;
            yangHui[i][i] = 1;//每一行的最后1个元素
            if(i>0) {
                System.out.print(yangHui[i][i] + "\t");
            }

            System.out.println();
        }


    }
}
